var app = angular.module('app');

app.directive('datePicker', [function () {
    return {
        templateUrl: 'tpl/datePicker/datePicker.html',
        restrict: 'EA',
        replace: false,
        scope: {
            maxDate: '=',
            minDate: '=',
            format: '@',
            isRequired: '=',
            ngModel: '=',
            placeHolder: '@'
        },
        link: function (scope, element, attrs) {
            scope.isOpened = false;
            scope.dateOptions = {
                formatYear: 'yyyy',
                startingDay: 1,
                showWeeks: false,
                autoclose: true
            };
            scope.openDate = function ($event) {
                $event.preventDefault();
                $event.stopPropagation();

                scope.isOpened = true;
            };
        }
    };
}]);